Summary#
This section has provided us with a foundation for working with file I/O in the Go language. We learned about the io package and its file abstractions and how to read and write files to disk. Then, we learned how to stream file content so that we can work with the network and be more efficient with memory. After that, we learned about the path/filepath package, which can help us deal with multiple OSs. Finally, we learned about Go's filesystem-agnostic interfaces for interacting with any filesystem, starting with the new embed filesystem.
We highly encourage you to read the standard library’s GoDoc pages to become familiar with its capabilities. The following are the GoDocs that were covered in this section. Here, we can find many useful utilities for dealing with files.
Quiz#
What is a way for embed to embed files?
As bytes
As a string
Into an embed.FS
All of the above
OS-Agnostic Filesystems
Introduction